package io;

import java.io.*;

public class Demo6 {
    public static void main1(String[] args) {
        try(InputStream inputStream=new FileInputStream("C:/test/text.txt")){
          while (true){
              byte[]bytes=new byte[1024];
              int n=inputStream.read(bytes);
              if (n==-1){
                  break;
              }
              for (int i = 0; i < n; i++) {
                  System.out.printf("%x\n", bytes[i]);
              }
          }
        }  catch (IOException e) {
         e.printStackTrace();
        }

    }

    public static void main(String[] args) {
        try(OutputStream outputStream=new FileOutputStream("C:/test/text.txt")){
            outputStream.write(65);
            outputStream.write(66);
            outputStream.write(67);
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
